package com.xy.simplefactory.pizzastore.order;

import com.xy.simplefactory.pizzastore.pizza.CheesePizza;
import com.xy.simplefactory.pizzastore.pizza.GreekPizza;
import com.xy.simplefactory.pizzastore.pizza.Pizza;

/**
 * @author 谢阳
 * @version 1.8.0_131
 * @date 2022/6/10 9:41
 * @description 返回披萨
 */
public class PizzaSimpleFactory {

    /**
     * 通过用户选择返回不同类型的披萨
     * @param orderType 1:希腊披萨 2:奶酪披萨 其他:null
     * @return
     */
    public static Pizza createPizza(String orderType) {
        Pizza pizza = null;
        switch (orderType) {
            case "1" : {
                pizza = new GreekPizza();
                break;
            }
            case "2" : {
                pizza = new CheesePizza();
                break;
            }
        }
        return pizza;
    }
}
